package io;

import java.util.Scanner;

public class Main {
    private static Scanner scanner = new Scanner(System.in);
    private static ImageManager imageManager = new ImageManager();
    public static void main(String[] args) {
        System.out.println("=== 图片下载系统 ===\n");
        while (true) {
            System.out.println("1. 下载图片\n" +
                    "2. 查看所有图片\n" +
                    "3. 搜索图片\n" +
                    "4. 退出");
            String choice = scanner.nextLine().trim();
            switch (choice) {
                case "1":
                    System.out.println("请输入图片地址：\n");
                    choice = scanner.nextLine().trim();
                    imageManager.downloadImage(choice);
                    break;
                case "2":
                    imageManager.ListImages();
                    break;
                case "3":
                    System.out.println("请输入图片名称：\n");
                    choice = scanner.nextLine().trim();
                    imageManager.searchImage(choice);
                    break;
                case "4":
                    return;
                default:
                    System.out.println("无效选择，请重新输入");
            }
        }
    }
}